#!/usr/bin/env python

# Imports:
# -------
from datetime import datetime

# ---------
class Log():
# ---------
	# -------------------------------------------------
	def __init__(self, logErrors, logWarnings, logInfo):
	# -------------------------------------------------
		self.logErrors = logErrors
		self.logWarnings = logWarnings
		self.logInfo = logInfo

	# ------------------------------------------
	def __formatMessage(self, severity, message):
	# ------------------------------------------
		now = datetime.now()
		return '%s[%s] - %s' % (str(severity), str(now), str(message))

	# ----------------------
	def warning(self, message):
	# ----------------------
		if self.logWarnings: 
			print self.__formatMessage('WARNING', message)
		
	# ----------------------
	def error(self, message):
	# ----------------------
		if self.logErrors: 
			print self.__formatMessage('ERROR', message)
		
	# ---------------------
	def info(self, message):
	# ---------------------
		if self.logInfo: 
			print self.__formatMessage('INFO', message)

# Instantiate the default log
__LOG = Log(True, True, True)

def error(message):
	__LOG.error(message)

def warning(message):
	__LOG.warning(message)

def info(message):
	__LOG.info(message)
